package com.hxalex.simulationhandle.accessbilityService.receiver.search.serivce;

import android.app.IntentService;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.util.Log;

/**
 * Created by hx_Alex on 2018/6/1.
 */

public class CheckSearchTimeService extends IntentService {
    private static final long MAXCOUNT=3;
    private boolean isFor=true;
    public static int waitCount=0;
    public static boolean isStart=false;
    public CheckSearchTimeService() {
        super("CheckSearchTimeService");
    }

    @Override
    protected void onHandleIntent(@Nullable Intent intent)
    {
        isStart=true;
        while (isFor){
            if(waitCount<MAXCOUNT)
            {
                waitCount++;
            }else
            {
                //超过一定时间未搜索到匹配词，认为搜索完毕，执行下一次操作
                Log.i("SearchWebContent","超过一定时间未搜索到匹配词，认为搜索完毕，执行下一次操作");
                isFor=false;
                isStart=false; 
            }

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
     
    }


  




}
